package yxy.cherry.data.input;

import org.redisson.api.RedissonClient;

import yxy.apple.util.redisson.FastjsonCodec;
import yxy.apple.util.redisson.RedisConnection;
import yxy.apple.util.redisson.RedisException;
import yxy.cherry.data.dfa.Sensitive;

public class Test {
	public static void main(String[] args) throws Exception {
		RedisConnection redis = new RedisConnection();
		try {
			redis.connect("redis://127.0.0.1:6379", "123456", 15, true, new FastjsonCodec());
			RedissonClient client = redis.client();

//			client.getKeys().deleteByPattern("DATA:v1.0.0.0:*");

//			DataCenter.init(redis, false);
//			FomulaScript.init(redis);
//
//			String[] names = { "sanxiaozengzhangtiaojian", "sanxiaobushushangxian", "guajishichang", "wujiangbeibaoshangxianchushi",
//					"wujiangbeibaoshangxiancishu", "wujiangbeibaoshangxianzengzhang", "wujiangbeibaoshangxianhuafei", "chushiwujiang", "wufangjianshang",
//					"fafangjianshang", "baoji", "baojilv", "mingzhong", "kongzhizengliang", "baoshang", "wushangjianmian", "fashangjianmian", "wushangjianmian",
//					"zhandouli", "shengjigongjitisheng", "shengjiwufangtisheng", "shengjifafangtisheng", "shengjishengmingtisheng", "leitaimeirimianfeicishu",
//					"leitaitiaozhanhuafei", "leitaishuaxinlengque", "leitaichushifenshu", "leitaisaijizhouqi", "jiaofeishuaxinmianfeicishu",
//					"wujiangshangdianshuaxinhuafei", "wujiangshangdianshangpinshu", "duobaojifenshangdianshuaxinhuafei", "duobaojifenshangdianshangpinshu",
//					"duobaojifenshangdianmianfeicishu", "bingfashangdianshuaxinhuafei", "bingfashangdianshangpinshu", "bingfashangdianmianfeicishu",
//					"bingfashangdianshuaxinshangxian", "shenbingshengjigongji", "shenbingshengjishengming", "shenbingzhuhunshengjigongji",
//					"shenbingzhuhunshengjishengming", "xiuliantasaodanghuafei", "kuafuliaotianhuafeiyuanbao", "lianmengbosschushicishu",
//					"lianmengbossgoumaicishu", "lianmengbossgoumaihuafei", "lianmengjinengchongzhihuafei" };
//
//			for (String name : names) {
//				System.err.println("===========>> " + name);
//				try {
//					Object result = FomulaScript.gogog(name, 0);
//					System.err.println("<<==	" + result.getClass().getName() + "::" + result);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//
//			System.err.println(fomula.物理防御减伤.doubleValue(100.0, 10.0));
			long time = System.currentTimeMillis();

			long mem = Runtime.getRuntime().freeMemory();
			System.err.println("mem:" + mem);

			Sensitive.init(redis);

			long passtime = System.currentTimeMillis() - time;
			System.err.println("加载用时：" + passtime);
			long mem2 = Runtime.getRuntime().freeMemory();
			System.err.println("mem:" + mem2);
			System.err.println("memsize:" + (mem - mem2));
			time = System.currentTimeMillis();

			String aaa = "所以每次使用完都,当使用完毕后都应当free掉";

			System.err.println(Sensitive.isSensitive(aaa));

			passtime = System.currentTimeMillis() - time;
			System.err.println("判断用时：" + passtime);

		} catch (RedisException e) {
			e.printStackTrace();
		} finally {
			redis.disconnect();
		}
	}
}
